package com.hnhegui.backend.order.dto.request;

import com.hnhegui.backend.order.enu.DeliveryTypeEnum;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.List;

@Getter
@Setter
public class CreateOrderRequestDTO {

    @NotBlank(message = "用户ID不能为空")
    private String userId;

    @NotEmpty(message = "订单商品不能为空")
    private List<OrderItemRequest> items;

    @NotNull(message = "配送类型不能为空")
    private DeliveryTypeEnum deliveryType;

    private ShippingAddressRequest shippingAddress;

    private String pickupStoreId;

    @Data
    public static class OrderItemRequest {
        @NotBlank(message = "商品ID不能为空")
        private String productId;

        @NotNull(message = "购买数量不能为空")
        private Integer quantity;

        @NotNull(message = "商品价格不能为空")
        private BigDecimal price;
    }

    @Data
    public static class ShippingAddressRequest {
        @NotBlank(message = "省份不能为空")
        private String province;

        @NotBlank(message = "城市不能为空")
        private String city;

        @NotBlank(message = "区县不能为空")
        private String district;

        @NotBlank(message = "详细地址不能为空")
        private String detail;

        @NotBlank(message = "收货人姓名不能为空")
        private String receiverName;

        @NotBlank(message = "收货人电话不能为空")
        private String receiverPhone;
    }
}
